package com.huhu.dto;

/**
 * @TODO Created by xuyi on 2016/9/6.
 */
public class Result {

    private int flag;

    private Object content;

    private String message;

    public Result() {}

    public Result(int flag, Object obj) {
        this.flag = flag;
        this.content = obj;
    }
    public static Result ok(Object content) {
        Result result = new Result();
        result.setFlag(1);
        result.setMessage("");
        result.setContent(content);
        return result;
    }
    public static Result error(String message) {
        Result result = new Result();
        result.setFlag(-2);
        result.setMessage(message);
        result.setContent("");
        return result;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public int getFlag() {
        return flag;
    }

    public void setFlag(int flag) {
        this.flag = flag;
    }

    public Object getContent() {
        return content;
    }

    public void setContent(Object content) {
        this.content = content;
    }
}
